Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. C# and c++/cli problem on x86 OS

C# and c++/cli problem on x86 OS

Scheduled Pinned Locked Moved Managed C++/CLI
helpcsharpc++question
2 Posts 2 Posters 14 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Duc Axenn
    wrote on last edited by
    #1

    Hi, i made a library in c++/cli and beside a c# program calling it. Everything works fine when i compile on any cpu or x64 on my pc (x64os/x64proc). But if i compile for x86, c# part works fine, but when i use the c++/cli part i get the error "could not load file or assembly .... incorrect format" . I use user32.lib in the c++/cli, is it possible the problem come from here ? ---- Edit I think it's ok, i activated copy reference to output project but i'm not sure it was that.

    D 1 Reply Last reply
    0
    • D Duc Axenn

      Hi, i made a library in c++/cli and beside a c# program calling it. Everything works fine when i compile on any cpu or x64 on my pc (x64os/x64proc). But if i compile for x86, c# part works fine, but when i use the c++/cli part i get the error "could not load file or assembly .... incorrect format" . I use user32.lib in the c++/cli, is it possible the problem come from here ? ---- Edit I think it's ok, i activated copy reference to output project but i'm not sure it was that.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      When you get a message like that, one project is compiling for either 32 or 64 bit and the other project is compiling for the opposite. If the target is "Any CPU", a project will compile so that if the code runs on a 64-bit machine, it'll run as a 64-bit process, and if on a 32-bit machine, as a 32-bit process. To solve this, make sure both projects build as either x64 or x86. Which depends on your requirements, but both projects have to build targeting the same thing.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
      Dave Kreskowiak

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups