Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

Compiling visual studio 2015 c++ project with g++ compiler [duplicate]

$
0
0

I am trying to compile my Visual Studio 2015 project with the g++ compiler. I know visual studio uses the MSVC compiler, but I tried compiling a minimal vs example with g++ and it worked (not sure if its the same with a big project).

In my project i am using crypto++ with it's header and source files and a compiled cryptlib.lib file. All of this is located in the dependencies folder.

My command is as follows:

g++ -I ../../dependencies/cryptopp860 -L ../../dependencies/cryptopp860/x64/Output/Release -lcryptlib KeyMaster.cpp LManager.cpp Terminal.cpp main.cpp

When i compile i get a bunch of errors like this:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\z004j2fz\AppData\Local\Temp\ccwYuppl.o:LManager:(.rdata$.refptr._ZTVN8CryptoPP21RandomNumberGeneratorE[.refptr._ZTVN8CryptoPP21RandomNumberGeneratorE]+0x0): undefined reference to `vtable for CryptoPP::RandomNumberGenerator'collect2.exe: error: ld returned 1 exit status

When i compile the project with a -c flag it works fine, so the errors must be located in the linking.

The folder structure is as follows:

  • project
    • dependencies
      • cryptopp860
        • Header/Source files
    • LManager
      • LManager.sln
      • LManager
        • main.cpp/h
        • KeyMaster.cpp/h
        • LManager.cpp/h
        • Terminal.cpp/h

Visual Studio is compiling the project with the following command:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /I../..\dependencies\cryptopp860 /Zi /nologo /W3 /WX- /sdl /O2 /Oi /GL /D _MBCS /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"x64\Release\\" /Fd"x64\Release\vc140.pdb" /doc"x64\Release\\" /Gd /TP /errorReport:prompt KeyMaster.cpp LManager.cpp Terminal.cpp main.cpp

The reason I want to use g++ is because I want to compile the project with a gitlab g++ pipeline. Maybe there is some easier way to create a gitlab pipeline for a visual studio project, but I didnt find it.


Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>